using Microsoft.AspNetCore.Mvc;
using MudWebApp.Repositories.Contracts;
using MudWebApp.Requests;
using MudWebApp.Responses;

namespace MudWebApp.Controllers;

[ApiController]
[Route("api/[controller]")]
public class AccountController(IAccount account) : Controller
{
    [HttpPost("login")]
    public async Task<ActionResult<RegisterResult>> RegisterAsync(LoginData data)
    {
        var result = await account.LoginAsync(data);
        return Ok(result);
    }

    [HttpPost("register")]
    public async Task<ActionResult<RegisterResult>> LoginAsync(RegisterData data)
    {
        var result = await account.RegisterAsync(data);
        return Ok(result);
    }
}